
module.exports = function ($scope, $state, $stateParams,$resource,$modal,FileUploader,toaster) {
  $scope.a = {}
  $scope.image = function(){
      var para = $state.get('app.imageupload');
      //设置上传文件夹，以自己业务命名
      angular.extend(para, {
        resolve : {  
          'dir' : function(){
            return 't1';
          }
        } 
      })
      console.log(para);
      var modalInstance = $modal.open(para);
      modalInstance.opened.then(function() {// 模态窗口打开之后执行的函数  
        console.log('modal is opened');  
      });  
      modalInstance.result.then(function(result) {  
        console.log(result);  
        $scope.imagearr = result;
        $scope.a.directory_pdf = $scope.imagearr.join(',');
      }, function(reason) {  
        console.log(reason);// 点击空白区域，总会输出backdrop  
        // click，点击取消，则会暑促cancel  
        $log.info('Modal dismissed at: ' + new Date());  
      }); 
  };

  $scope.del=function(index){
      $scope.imagearr.splice(index,1);
      $scope.a.directory_pdf=$scope.imagearr.join(',');
  }

  $scope.submit = function(){
      $resource('/api/as/ggc/reviewGuide/createDirectory', {}, {}).save($scope.a, function(res){
          if(res.errcode === 0){ 
              toaster.success({title:"",body:'操作成功'});
              $state.go('app.projectGuide');
          }else{
              toaster.error({title:"",body:res.errmsg});
          }
      });
  }
    


};
